]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dbusServices/extensions: Give extensions access to the prefs window
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 30 Jul 2021 08:12:11 +0000 (10:12 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 8 Feb 2022 19:11:19 +0000 (19:11 +0000)
The current preference API - buildPrefsWidget() - predates client-side
decorations. While extension authors have been finding ways around
the limitation of not having access to the window/titlebar, the change
to the new Adwaita API seems like a good time for an updated API that
officially provides that access (as far as allowed by libadwaita).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>

js/dbusServices/extensions/extensionPrefsDialog.js

index 85e1364da8b57231c2f1cff7a93c7072fb001dee..4e90da4e70d07101a684dbc8a8f8769dad8cb018 100644 (file)
@@ -23,9 +23,16 @@ var ExtensionPrefsDialog = GObject.registerClass({
             const prefsModule = extension.imports.prefs;
             prefsModule.init(extension.metadata);
 
-            const widget = prefsModule.buildPrefsWidget();
-            const page = this._wrapWidget(widget);
-            this.add(page);
+            if (prefsModule.fillPreferencesWindow) {
+                prefsModule.fillPreferencesWindow(this);
+
+                if (!this.visible_page)
+                    throw new Error('Extension did not provide any UI');
+            } else {
+                const widget = prefsModule.buildPrefsWidget();
+                const page = this._wrapWidget(widget);
+                this.add(page);
+            }
         } catch (e) {
             this._showErrorPage(e);
             logError(e, 'Failed to open preferences');